home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 4386 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.5 KB

  1. Path: news.mindlink.net!uniserve!usenet
  2. From: nowher@anyplace.com (Chris)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Help!! I'm a stuck newbie - input problem
  5. Date: 30 Jan 1996 03:09:40 GMT
  6. Organization: UNIServe Online
  7. Distribution: world
  8. Message-ID: <4ek25k$qta@atlas.uniserve.com>
  9. References: <4eh3vl$g8i@atlas.uniserve.com> <4eipbe$jnd@nic.cc.ruu.nl>
  10. NNTP-Posting-Host: van0128.tvs.net
  11. Mime-Version: 1.0
  12. X-Newsreader: WinVN 0.99.2
  13.  
  14. In article <4eipbe$jnd@nic.cc.ruu.nl>, erikp says...
  15. >
  16. >Hi Chris,
  17. >
  18. >You can use the C-function <strncpy> or <sprintf> to limit the number
  19. >of characters copied into an array, or by formatting an iostream object.
  20. >But I'm not sure I understand your problem...
  21. >Erik
  22.  
  23.  
  24. I have tried the strncpy function and it limits the length of the input. 
  25. I also tried cin.width which also nicely limited the length of the input 
  26. string.  My exact problem is that I don't wan't the cursor to over-run 
  27. the width of the field:
  28.  
  29. Part Number:(            )
  30.      Length:(    )
  31.       Width:(    )
  32.     .
  33.     .
  34.     .
  35.  
  36. The bracket on the right should be the limit of the input.  I would like 
  37. to beep the user when/if the user reaches the right side of the field.
  38. I have tried the getch() function in conjunction with wherex(), but this 
  39. failed. Perhaps I am asking the wrong question. What is the easiest way 
  40. of dealing with an array of char?
  41.  
  42. Actually, when I use   char PartNum[20];  I have trouble assigning a 
  43. value to it. I get the error --Lvalue required--.
  44.  
  45. Terribly sorry if this isn't any more clear.
  46.  
  47. Thanks for any help!
  48.  
  49. Chris
  50.  
  51.